package com.yihaodian.search.fetch;

import java.util.Arrays;

import com.yihaodian.api.common.Response;
import com.yihaodian.api.search.misc.SearchHit;
import com.yihaodian.index.meta.shard.Shard;

public class FetchSearchResult extends Response implements FetchSearchResultProvider{
	private long id;
    private Shard shard;
    private SearchHit[] hits;
    // Curor to record current hit index.
    private int curor;
	@Override
	public long id() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	@Override
	public Shard getShard() {
		return shard;
	}
	public void setShard(Shard shard) {
		this.shard = shard;
	}
	public SearchHit[] getHits() {
		return hits;
	}
	public void setHits(SearchHit[] hits) {
		this.hits = hits;
	}
	
	public int next(){
		return curor++;
	}
	
	@Override
	public FetchSearchResult fetchResult() {
		return this;
	}
	
	@Override
	public String toString() {
		return "FetchResult [id=" + id + ", shard=" + shard + ", hits="
				+ Arrays.toString(hits) + "]";
	}
}
